package lambdas;

import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.function.BinaryOperator;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class lambdas1 {
    public static void main(String[] args) {
        List<String> beginningWithNumbers = Stream.of("a", "123ab", "abdc1")
                .filter(value -> Character.isDigit(value.charAt(0)))
                .collect(Collectors.toList());

        Integer reduce = Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9).reduce(0, Integer::sum);

        BinaryOperator<Integer> accmulator = Integer::sum;
        accmulator.apply(accmulator.apply(accmulator.apply(0, 1), 2), 3);

        IntSummaryStatistics intSummaryStatistics = Stream.of(1, 2, 3, 4, 5, 6, 8).mapToInt(track -> track).summaryStatistics();
        System.err.println("Sum: " + intSummaryStatistics.getSum()
                + ", Average: " + intSummaryStatistics.getAverage()
                + ", Min: " + intSummaryStatistics.getMin()
                + ", Max: " + intSummaryStatistics.getMax());

    }


}
